package com.zlzlib.libindexpy.helper;

import android.content.Context;

/**
 * Created by zlz on 2019/11/4.
 * 城市拼音多音字字典
 * 添加中文城市词典
 * Pinyin.init(Pinyin.newConfig().with(PyCityMap.getInstance(app)));
 */
public class PyCityMap extends AndroidAssetDict {

    static volatile PyCityMap singleton = null;

    public PyCityMap(Context context) {
        super(context);
    }

    @Override
    protected String assetFileName() {
        return "cnCity";
    }

    public static PyCityMap getInstance(Context context) {
        if (context == null) {
            throw new IllegalArgumentException("context == null");
        }
        if (singleton == null) {
            synchronized (PyCityMap.class) {
                if (singleton == null) {
                    singleton = new PyCityMap(context);
                }
            }
        }
        return singleton;
    }
}
